package com.ruoyi.yqhs.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.yqhs.domain.YqhsKqzlz;
import com.ruoyi.yqhs.service.IYqhsKqzlzService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 空气质量站信息Controller
 * 
 * @author ruoyi
 * @date 2025-08-31
 */
@RestController
@RequestMapping("/yqhs/kqzlz")
public class YqhsKqzlzController extends BaseController
{
    @Autowired
    private IYqhsKqzlzService yqhsKqzlzService;

    /**
     * 查询空气质量站信息列表
     */
    @PreAuthorize("@ss.hasPermi('yqhs:kqzlz:list')")
    @GetMapping("/list")
    public TableDataInfo list(YqhsKqzlz yqhsKqzlz)
    {
        startPage();
        List<YqhsKqzlz> list = yqhsKqzlzService.selectYqhsKqzlzList(yqhsKqzlz);
        return getDataTable(list);
    }

    /**
     * 导出空气质量站信息列表
     */
    @PreAuthorize("@ss.hasPermi('yqhs:kqzlz:export')")
    @Log(title = "空气质量站信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, YqhsKqzlz yqhsKqzlz)
    {
        List<YqhsKqzlz> list = yqhsKqzlzService.selectYqhsKqzlzList(yqhsKqzlz);
        ExcelUtil<YqhsKqzlz> util = new ExcelUtil<YqhsKqzlz>(YqhsKqzlz.class);
        util.exportExcel(response, list, "空气质量站信息数据");
    }

    /**
     * 获取空气质量站信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('yqhs:kqzlz:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(yqhsKqzlzService.selectYqhsKqzlzById(id));
    }

    /**
     * 新增空气质量站信息
     */
    @PreAuthorize("@ss.hasPermi('yqhs:kqzlz:add')")
    @Log(title = "空气质量站信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody YqhsKqzlz yqhsKqzlz)
    {
        return toAjax(yqhsKqzlzService.insertYqhsKqzlz(yqhsKqzlz));
    }

    /**
     * 修改空气质量站信息
     */
    @PreAuthorize("@ss.hasPermi('yqhs:kqzlz:edit')")
    @Log(title = "空气质量站信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody YqhsKqzlz yqhsKqzlz)
    {
        return toAjax(yqhsKqzlzService.updateYqhsKqzlz(yqhsKqzlz));
    }

    /**
     * 删除空气质量站信息
     */
    @PreAuthorize("@ss.hasPermi('yqhs:kqzlz:remove')")
    @Log(title = "空气质量站信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(yqhsKqzlzService.deleteYqhsKqzlzByIds(ids));
    }
}
